import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/reset.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const authRoutes = localStorage.getItem('authRoutes')
  ? JSON.parse(localStorage.getItem('authRoutes'))
  : []
// 解决 动态添加路由刷新丢失问题
if (authRoutes.length) {
  store.commit('user/ADD_AUTH_ROUTES', authRoutes)
}
const app = createApp(App)
// 设置国际化 字体提示语种  注意引入
app.use(ElementPlus, {
  locale: zhCn
})

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(store).use(router).mount('#app')
